package com.example.scrawldemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;

import com.example.scrawldemo.util.BitmapUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Project:AndroidDemo
 * Author:dyping
 * Date:2017/4/11 14:51
 */

public class ScreenShotActivity extends Activity {

    String path;
    @BindView(R.id.screen_wangluo)
    Button screenWangluo;
    @BindView(R.id.screen_bendi)
    Button screenBendi;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_screen_shot);
        ButterKnife.bind(this);

//
    }
    Intent intent;
    @OnClick({R.id.screen_wangluo, R.id.screen_bendi})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.screen_wangluo:
                path = "http://pic9.nipic.com/20100914/5521709_141040064499_2.jpg";
          intent = new Intent();
        intent.putExtra("url", path);
        intent.setClass(this, ScrawlActivity.class);
        startActivity(intent);
                break;
            case R.id.screen_bendi:
           path = this.getExternalFilesDir(Environment.DIRECTORY_PICTURES) + "/"+System.currentTimeMillis()+"ChintScreenShot.png";
           BitmapUtil.SaveScreenShot(this, path);
          intent = new Intent();
        intent.putExtra("url", path);
        intent.setClass(this, ScrawlActivity.class);
        startActivity(intent);
                break;
        }
    }


//    @OnClick(R.id.screen_shot)
//    public void onViewClicked() {

//
//    }
}
